<?php

/*
定义骨头系统最常用的常量

DS: 目录分格符
	windows 下为右斜杠, 如 C:\windnow\system\
	linux 下为左斜杠。 /var/www/

BONE_ROOT：骨头系统的根路径
ADMIN: 后台目录
BONE_ADMIN: 后台绝对路径
BONE_URL: 网站网址
*/

define( 'DS', DIRECTORY_SEPARATOR );
define( 'BONE_ADMIN', dirname(__FILE__) );
$pos = strrpos(BONE_ADMIN, DS);
define( 'ADMIN', substr(BONE_ADMIN, $pos+1) );
define( 'BONE_ROOT', substr(BONE_ADMIN, 0, $pos) );

$url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ? 'https://' : 'http://';
$url .= isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']));
$url .= substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], ADMIN)-1 );
define( 'BONE_URL', $url );

require BONE_ADMIN.DS.'system'.DS.'worker.php';
?>